package com.marketingManagement.controller.api;

import com.eight.pojo.SmsAdvertisePosition;
import com.eight.vo.ComResult;
import com.marketingManagement.service.impl.advertisePositionServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author caoch
 * @since 2023/3/1 10:01
 **/
@RestController
@RequestMapping("/marketingManagement/api")
public class advertisePositionApiController {
	@Autowired
	private advertisePositionServiceImpl advertisePositionService;
	@RequestMapping("addAdvertisePosition")
	public ComResult addAdvertisePosition(@RequestBody SmsAdvertisePosition position) {
		return new ComResult(2000,"success",advertisePositionService.addAdvertisePosition(position));
	}
	@RequestMapping("updateAdvertisePosition")
	public ComResult updateAdvertisePosition(@RequestBody SmsAdvertisePosition position) {
		return new ComResult(2000,"success",advertisePositionService.updateAdvertisePosition(position));
	}
	@RequestMapping("removeAdvertisePosition/{id}")
	public ComResult removeAdvertisePosition(@PathVariable int id) {
		return new ComResult(2000,"success",advertisePositionService.removeAdvertisePosition(id));
	}
	@RequestMapping("selectAdvertisePosition")
	public ComResult selectAdvertisePosition(@RequestParam(defaultValue = "1")Integer currentPage,
	                                 @RequestParam(defaultValue = "5")Integer pageSize,
	                                 @RequestBody SmsAdvertisePosition position ) {
		return new ComResult(2000,"success",advertisePositionService.selectAdvertisePosition(currentPage, pageSize, position));
	}
}
